#!/bin/bash

set -o errexit

test_dir=$(realpath $(dirname $0))
. ${test_dir}/../functions

set_debug

create_infra $namespace
deploy_cert_manager

desc 'create PXC cluster'
cluster="side-car"
size="3"
spinup_pxc "$cluster" "$test_dir/conf/$cluster.yml" "$size" "10" "${conf_dir}/secrets_without_tls.yml"
wait_cluster_consistency "$cluster" "$size" "2"

desc 'check if service and statefulset created with expected config'
compare_kubectl service/$cluster-proxysql
compare_kubectl statefulset/$cluster-proxysql

destroy $namespace
desc "test passed"
